using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Money_Log_Mobile
{
    public partial class frmStandingOrder : Form
    {
        private Bank oBank;
        private StandingOrderFrequency eStandingOrderFrequency = StandingOrderFrequency.Daily;
        public frmStandingOrder(Bank BankOpen)
        {
            oBank = BankOpen;
            InitializeComponent();
            rbMonthly.Enabled = false;

        }

        private void menuItem2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void menuItem1_Click(object sender, EventArgs e)
        {
            try
            {
                Double.Parse(textBox2.Text);
                oBank.AddStandingOrder(textBox3.Text, Convert.ToDouble(textBox2.Text), new List<string>(),eStandingOrderFrequency);
                this.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Enter a valid number");
            }
            
        }

        private void rbDaily_CheckedChanged(object sender, EventArgs e)
        {
            eStandingOrderFrequency = StandingOrderFrequency.Daily;
        }

        private void rbWeekly_CheckedChanged(object sender, EventArgs e)
        {
            eStandingOrderFrequency = StandingOrderFrequency.Weekly;
        }

        private void rbMonthly_CheckedChanged(object sender, EventArgs e)
        {
            eStandingOrderFrequency = StandingOrderFrequency.Monthly;
        }

        private void rbYearly_CheckedChanged(object sender, EventArgs e)
        {
            eStandingOrderFrequency = StandingOrderFrequency.Yearly;
        }

        private void rbWeekDay_CheckedChanged(object sender, EventArgs e)
        {
            eStandingOrderFrequency = StandingOrderFrequency.WorkDay;
        }
    }
}